using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using PlugNT.Safe;
using PlugNT.Custom;
using PlugNT.Cms.Model;
namespace PlugNT.Cms.BLL
{
    public class FriendLink
    {

        private static readonly PlugNT.Cms.DAL.FriendLink dal = new PlugNT.Cms.DAL.FriendLink();







        public string CreateLinks(string clsno, string splitstr)
        {
            return dal.CreateLinks(StringHelper.SqlFilter(clsno), splitstr);
        }






        public void RemoveLinks()
        {
            dal.RemoveLinks();
        }






        public bool RemoveLinks(string clsno)
        {
            return dal.RemoveLinks(StringHelper.SqlFilter(clsno));
        }






        public FriendLinkInfo GetFriendLinkInfo(int id)
        {
            return dal.GetFriendLinkInfo(id);

        }







        public DataTable GetRowTable(int id)
        {
            return dal.GetRowTable(id);
        }









        public bool Add(FriendLinkInfo model)
        {
            return dal.Add(model);
        }






        public bool Update(FriendLinkInfo model)
        {
            return dal.Update(model);
        }






        public bool Delete(int id)
        {
            return dal.Delete(id);
        }






        public bool Delete(string clsno)
        {
            return dal.Delete(StringHelper.SqlFilter(clsno));
        }


        public DataTable GetList(int topCount, int currPageCount, string clsno, bool showSql, out int recordCount)
        {
            StringBuilder andWhere = new StringBuilder();

            if (clsno != "")
            {
                andWhere.Append(" and [clsno]='" + StringHelper.SqlFilter(clsno) + "'");
            }
            recordCount = dal.GetCount(andWhere.ToString());
            return dal.GetList(topCount, currPageCount, andWhere.ToString(), showSql);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="topCount"></param>
        /// <param name="currPageCount"></param>
        /// <param name="clsno"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public DataTable GetList(int topCount, int currPageCount, string clsno, int type)
        {
            StringBuilder andWhere = new StringBuilder();

            if (clsno != "")
            {
                andWhere.Append(" and [clsno]='" + StringHelper.SqlFilter(clsno) + "'");

            }
            andWhere.Append(" and [type]='" + type + "'");
            return dal.GetList(topCount, currPageCount, andWhere.ToString(), false);
        }
































    }
}
